import requests

class FeishuNotifier:
    def __init__(self, webhook_url):
        self.webhook_url = webhook_url

    def send_message(self, message):
        try:
            headers = {
                'Content-Type': 'application/json'
            }
            data = {
                'msg_type': 'text',
                'content': {
                    'text': message
                }
            }
            response = requests.post(self.webhook_url, json=data, headers=headers)
            response.raise_for_status()
        except Exception as e:
            print(f'发送飞书消息失败: {e}')

